package com.huawei.gamebox.service.appdetail.fragment;

import android.text.TextUtils;
import android.view.View;
import androidx.core.view.ViewCompat;
import com.huawei.appgallery.foundation.ui.css.CSSRule;
import com.huawei.appgallery.foundation.ui.css.CSSSelector;
import com.huawei.appgallery.foundation.ui.css.CSSStyleSheet;
import com.huawei.appgallery.foundation.ui.css.CSSView;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseDetailResponse.Layout;
import com.huawei.appgallery.foundation.ui.framework.widget.NodataWarnLayout;
import com.huawei.gamebox.framework.cardkit.bean.WiseJointDetailResponse;
import com.huawei.gamebox.framework.cardkit.fragment.CardListFragment;
import com.huawei.gamebox.service.appdetail.fragment.WelfareFragmentProtocol.b;
import java.util.List;
import o.cip;
import o.ciz;
import o.Logger;
import o.exp.j;
import o.eyi;
import org.json.JSONObject;

public class WelfareFragment extends CardListFragment<WelfareFragmentProtocol> implements ciz {
    private int ʹ;
    private String ʻˋ;
    private String ﾞ;

    public void ᐝʼ() {
        super.ᐝʼ();
        WelfareFragmentProtocol welfareFragmentProtocol = (WelfareFragmentProtocol) ˆ();
        if (welfareFragmentProtocol != null && welfareFragmentProtocol.ॱ() != null) {
            b bVar = (b) welfareFragmentProtocol.ॱ();
            this.ॱꜟ = bVar.ᐝॱ();
            ˋॱ(bVar.ʻॱ());
            ʻॱ(bVar.ˋॱ());
            ˎ(bVar.ʻ());
            ʻ(bVar.ʼ());
            ॱˊ(bVar.ʽ());
            ʼ(bVar.ॱॱ());
            ˊ(bVar.ˌ());
            ˏ(bVar.ˎˎ());
            ʽ("gss|welfare_app");
            this.ʹ = bVar.ˊॱ();
            this.ﾞ = bVar.ᐝ();
            this.ʻˋ = bVar.ˏॱ();
        }
    }

    public void ˋ(eyi o_eyi, WiseJointDetailResponse<?> wiseJointDetailResponse) {
        super.ˋ(o_eyi, (WiseJointDetailResponse) wiseJointDetailResponse);
        if (!TextUtils.isEmpty(this.ﾞ)) {
            try {
                wiseJointDetailResponse.ˏ(new JSONObject(this.ﾞ));
                List ʻॱ = wiseJointDetailResponse.ʻॱ();
                int size = ʻॱ.size();
                for (int i = 0; i < size; i++) {
                    ((Layout) ʻॱ.get(i)).ॱ(this.ʻˋ);
                }
            } catch (Throwable e) {
                Logger.ˋ("CardListFragment", "Exception", e);
            }
        } else if (Logger.ˎ()) {
            Logger.ˏ("CardListFragment", "css is empty");
        }
    }

    public void ॱˍ() {
        if (this.ॱˌ != null && this.ʹ == 1 && (this.ॱˌ instanceof cip)) {
            ˊ(((cip) this.ॱˌ).ॱ());
        }
    }

    public void ॱ(NodataWarnLayout nodataWarnLayout) {
        super.ॱ(nodataWarnLayout);
        if (nodataWarnLayout != null && this.ʹ == 1) {
            ˊ(nodataWarnLayout);
        }
    }

    private void ˊ(View view) {
        if (this.ﾞ != null && this.ʻˋ != null && view != null) {
            CSSSelector cSSSelector = new CSSSelector(this.ʻˋ);
            CSSStyleSheet parse = CSSStyleSheet.parse(this.ﾞ);
            if (parse != null) {
                CSSRule rule = cSSSelector.getRule(parse.getRootRule());
                if (rule != null) {
                    CSSView.wrap(view, rule).render();
                }
            }
        }
    }

    public int ߵ() {
        return j.ॱʼ;
    }

    public boolean ad_() {
        if (this.ͺˎ == null || ViewCompat.ˏ(this.ͺˎ, -1)) {
            return false;
        }
        return true;
    }
}
